package com.cam.generator.mapStruct;

import com.cam.generator.dto.GenCodeDTO;
import com.cam.generator.entity.GenCode;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface GenCodeMapStruct {

    @Mappings({
            @Mapping(source = "createBy", target = "createBy.id"),
            @Mapping(source = "updateBy", target = "updateBy.id")
    })
    GenCodeDTO toDTO(GenCode genCode);


    @Mappings({
            @Mapping(source = "createBy.id", target = "createBy"),
            @Mapping(source = "updateBy.id", target = "updateBy")
    })
    GenCode toEntity(GenCodeDTO genCodeDTO);

}
